<?php
class Zendvn_Model_Table_QueueItem extends Zend_Db_Table{
	protected $_name = "queue_item";
	protected $_primary = "id"; 
	protected $_arrParam = array();

	
	protected $_listSQL;

	public function addItem($arrParam = null){
		$db = $this->getAdapter();
        $db->insert($this->_name,array('fk_news_item'=>$arrParam['id_item']));
	}
	public function deleteItem($id){
		$db = $this->getAdapter();

        $where = 'fk_news_item = '.$id;
        $db->delete($this->_name,$where);
	}

    public function listItem($arrParam = null){
        $db = $this->getAdapter();

        $select = $db->select()
            ->from('queue_item AS q',null)
            ->joinInner('news_item AS n','q.fk_news_item = n.id',array('website','id'))
            ->group('q.fk_news_item')
        ;

        return $db->fetchAll($select);
    }
	

}